package com.example.demo.entity;

import org.babyfish.jimmer.sql.Column;
import org.babyfish.jimmer.sql.Entity;
import org.babyfish.jimmer.sql.GeneratedValue;
import org.babyfish.jimmer.sql.GenerationType;
import org.babyfish.jimmer.sql.Id;
import org.babyfish.jimmer.sql.JoinColumn;
import org.babyfish.jimmer.sql.ManyToOne;
import org.babyfish.jimmer.sql.Table;

/**
 * 资源
 *
 * @author jimmer
 * @since 2024-02-03 02:20:59
 */
@Entity
@Table(name = "resource")
public interface Resource {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    long id();

    /**
     * 名称
     */
    @Column(name = "name")
    String name();

    /**
     * 菜单项
     */
    @ManyToOne
    @JoinColumn(
            name = "menu_id",
            referencedColumnName = "id"
    )
    Menu menu();

    /**
     * 所有人
     */
    @ManyToOne
    @JoinColumn(
            name = "owner_id",
            referencedColumnName = "id"
    )
    Owner owner();
}
